﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using log4net;

namespace DCT.CodeBox.Log4netWrapper.WebSample
{
    public class Global : System.Web.HttpApplication
    {
        /// <summary>
        /// 初始化wrapper
        /// </summary>
        private static DCT.CodeBox.Log4netWrapper.Codes.Log4netWrapper wrapper = new Codes.Log4netWrapper();

        /// <summary>
        /// 获取log
        /// </summary>
        public static ILog Log {
            get {
                return wrapper.GetLogger();
            }
        }

        protected void Application_Start(object sender, EventArgs e)
        {
            //初始化wrapper
            wrapper.SetInitialConfig(Codes.Log4netWrapper.InitialConfigFromWebFile("~/logConfig.xml"));
            wrapper.DefaultLoggerName = "myLogger";
        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}